import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '表头Id',
    align:"center",
    dataIndex: 'headerId'
   },
   {
    title: '商品Id',
    align:"center",
    dataIndex: 'materialId'
   },
   {
    title: '商品扩展id',
    align:"center",
    dataIndex: 'materialExtendId'
   },
   {
    title: '商品计量单位',
    align:"center",
    dataIndex: 'materialUnit'
   },
   {
    title: '多属性',
    align:"center",
    dataIndex: 'sku'
   },
   {
    title: '数量',
    align:"center",
    dataIndex: 'operNumber'
   },
   {
    title: '基础数量，如kg、瓶',
    align:"center",
    dataIndex: 'basicNumber'
   },
   {
    title: '单价',
    align:"center",
    dataIndex: 'unitPrice'
   },
   {
    title: '采购单价',
    align:"center",
    dataIndex: 'purchaseUnitPrice'
   },
   {
    title: '含税单价',
    align:"center",
    dataIndex: 'taxUnitPrice'
   },
   {
    title: '金额',
    align:"center",
    dataIndex: 'allPrice'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '仓库ID',
    align:"center",
    dataIndex: 'depotId'
   },
   {
    title: '调拨时，对方仓库Id',
    align:"center",
    dataIndex: 'anotherDepotId'
   },
   {
    title: '税率',
    align:"center",
    dataIndex: 'taxRate'
   },
   {
    title: '税额',
    align:"center",
    dataIndex: 'taxMoney'
   },
   {
    title: '价税合计',
    align:"center",
    dataIndex: 'taxLastMoney'
   },
   {
    title: '商品类型',
    align:"center",
    dataIndex: 'materialType'
   },
   {
    title: '序列号列表',
    align:"center",
    dataIndex: 'snList'
   },
   {
    title: '批号',
    align:"center",
    dataIndex: 'batchNumber'
   },
   {
    title: '有效日期',
    align:"center",
    dataIndex: 'expirationDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '关联明细id',
    align:"center",
    dataIndex: 'linkId'
   },
   {
    title: '租户id',
    align:"center",
    dataIndex: 'tenantId'
   },
   {
    title: '删除标记，0未删除，1删除',
    align:"center",
    dataIndex: 'deleteFlag'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '表头Id',
    field: 'headerId',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入表头Id!'},
          ];
     },
  },
  {
    label: '商品Id',
    field: 'materialId',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入商品Id!'},
          ];
     },
  },
  {
    label: '商品扩展id',
    field: 'materialExtendId',
    component: 'InputNumber',
  },
  {
    label: '商品计量单位',
    field: 'materialUnit',
    component: 'Input',
  },
  {
    label: '多属性',
    field: 'sku',
    component: 'Input',
  },
  {
    label: '数量',
    field: 'operNumber',
    component: 'InputNumber',
  },
  {
    label: '基础数量，如kg、瓶',
    field: 'basicNumber',
    component: 'InputNumber',
  },
  {
    label: '单价',
    field: 'unitPrice',
    component: 'InputNumber',
  },
  {
    label: '采购单价',
    field: 'purchaseUnitPrice',
    component: 'InputNumber',
  },
  {
    label: '含税单价',
    field: 'taxUnitPrice',
    component: 'InputNumber',
  },
  {
    label: '金额',
    field: 'allPrice',
    component: 'InputNumber',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '仓库ID',
    field: 'depotId',
    component: 'InputNumber',
  },
  {
    label: '调拨时，对方仓库Id',
    field: 'anotherDepotId',
    component: 'InputNumber',
  },
  {
    label: '税率',
    field: 'taxRate',
    component: 'InputNumber',
  },
  {
    label: '税额',
    field: 'taxMoney',
    component: 'InputNumber',
  },
  {
    label: '价税合计',
    field: 'taxLastMoney',
    component: 'InputNumber',
  },
  {
    label: '商品类型',
    field: 'materialType',
    component: 'Input',
  },
  {
    label: '序列号列表',
    field: 'snList',
    component: 'Input',
  },
  {
    label: '批号',
    field: 'batchNumber',
    component: 'Input',
  },
  {
    label: '有效日期',
    field: 'expirationDate',
    component: 'DatePicker',
  },
  {
    label: '关联明细id',
    field: 'linkId',
    component: 'InputNumber',
  },
  {
    label: '租户id',
    field: 'tenantId',
    component: 'InputNumber',
  },
  {
    label: '删除标记，0未删除，1删除',
    field: 'deleteFlag',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}